<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<base href="<%=basePath%>">

<meta name="description" content="">
<meta name="author" content="">
<!--<link rel="icon" href="../../favicon.ico">-->

<!-- <title>Bootstrap Demo</title> -->

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!--文件上传 -->
<link href="<%=path%>/css/fileinput.min.css" media="all"
	rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/css/mystyle.css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/css/chart.css" />
<link href="<%=path%>/css/fileinput.css" media="all" rel="stylesheet"
	type="text/css" />

<!-- Custom styles for this template -->
<!-- <link href="navbar-static-top.css" rel="stylesheet"> -->

<link type="text/css" rel="stylesheet" href="<%=path%>/css/mystyle.css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/css/chart.css" />
<script src="<%=path%>/js/jquery.min.js"></script>
<script src="<%=path%>/js/bootstrap.min.js"></script>

<!--文件上传 -->
<script src="<%=path%>/js/file/fileinput.js" type="text/javascript"></script>
<script src="<%=path%>/js/file/fileinput_locale_fr.js"
	type="text/javascript"></script>
<script src="<%=path%>/js/file/fileinput_locale_es.js" type="text/javascript"></script> 

</head>


<body>
	<!-- Begin Content -->
	<div class="panel panel-default">
		<div class="row">
			<div class="panel-body col-md-3 col-lg-3 col-sm-3">
				<input id="kk" type="text" class="form-control "
					placeholder="Nodes Number K" aria-describedby="basic-addon1" onchange="change();">
			</div>
			<div class="panel-body col-md-6 col-lg-6 col-sm-6">
				<form enctype="multipart/form-data">
					<div class="form-group">
						<input id="dataFile" class="file" type="file">
					</div>
				</form>
			</div>
			<div class="panel-body col-md-3 col-lg-3 col-sm-3">
				<div class="btn-group ">
					<button type="button" class="btn btn-default dropdown-toggle"
						data-toggle="dropdown" aria-expanded="false">
						Data Analysis Methods<span class="caret"></span>
					</button>
					<ul class="dropdown-menu" role="menu">
						<li><a href="<%=path%>/duansky/bar_chart.html"
							target="chartframe1">Bar Chart</a></li>
						<li><a href="<%=path%>/duansky/pie_chart.html"
							target="chartframe1">Pie Chat</a></li>
						<li><a href="<%=path%>/duansky/topK.html"
							target="chartframe1">Top K</a></li>
						<li><a href="<%=path%>/duansky/bottomK.html"
							target="chartframe1">Bottom K</a></li>
						<li><a href="<%=path%>/duansky/randomK.html"
							target="chartframe1">RandomK</a></li>
						<li><a href="<%=path%>/duansky/cluster.html"
							target="chartframe1">Cluster</a></li>
						<li><a href="<%=path%>/duansky/complete.html"
							target="chartframe1">Complete</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<div class="panel panel-default">
		<div class="content">
			<iframe height=700px width=100% src="" frameborder="0"
				marginheight="0" marginwidth="0" scrolling="yes" id="chartframe1"
				name="chartframe1"></iframe>
		</div>
	</div>
	<!-- End Content -->
</body>

<script>
$("#dataFile").fileinput({
		uploadUrl : '<%=path%>/skyFileServlet', // you must set a valid URL here else you will get an error
		overwriteInitial : false,
		showPreview : false,
		maxFileSize : 10000,
		maxFilesNum : 10,
		allowedFileTypes: ['txt'],
		slugCallback : function(filename) {
			return filename.replace('(', '_').replace(']', '_');
		}
	});

function change() {
	var re =/^[1-9]+[0-9]*]*$/; 
	var k = document.getElementById("kk").value;
	if (re.test(k)) {
		$.ajax({
			type : "post",//请求方式
			url : "servlet/kekeServlet",//发送请求地址
			dataType : "json",
			data : {
				id : k
			}
		});
	}
	else{
		alert("节点个数应该为正数！");
		return;
	}
}
	
</script>
</html>
